using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Move : MonoBehaviour
{
    float moveSpeed = 30f;
    float speed_ratio = 1;
    int move_flag = 0;
    Vector3 end_pos;
    void Update(){
        if (move_flag == 1){
            transform.position=Vector3.MoveTowards(transform.position,end_pos,moveSpeed*speed_ratio*Time.deltaTime);
            if(transform.position == end_pos)
                move_flag = 0;
        }
    }
    public void MovePosition(Vector3 position, float ratio){
        end_pos = position;
        speed_ratio = ratio;
        move_flag = 1;
    }
}